Skip to content

Add type hints to Hubbard constructors#1307

Closed
adminlip wants to merge 1 commit into
quantumlib:mainfrom
adminlip:fix/type-hints-ops
Closed

Add type hints to Hubbard constructors#1307
adminlip wants to merge 1 commit into
quantumlib:mainfrom
adminlip:fix/type-hints-ops

Conversation

@adminlip
Copy link
Copy Markdown

This adds explicit annotations to the public Fermi- and Bose-Hubbard constructor signatures, covering the dimensions, scalar model parameters, boolean options, and concrete operator return types. The change keeps the implementations unchanged while making this Hamiltonian module easier to type-check incrementally as part of the broader type-hinting effort. Verified with python3 -m compileall -q src/openfermion/hamiltonians/hubbard.py, targeted signature assertions, and git diff --check.

Part of #633

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 14, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds type hints to the fermi_hubbard and bose_hubbard functions in src/openfermion/hamiltonians/hubbard.py. These hints specify the expected types for dimensions, physical constants like tunneling and interaction terms, and boolean flags, while also defining the return types as FermionOperator and BosonOperator. No review comments were provided for these changes, and I have no further feedback.

@mhucka
Copy link
Copy Markdown
Contributor

mhucka commented May 16, 2026

@adminlip Please identify yourself as a human or a software agent.

@mhucka
Copy link
Copy Markdown
Contributor

mhucka commented May 17, 2026

Closing because this is a software agent.

@mhucka mhucka closed this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants